/*
This is an example script for a circle. Click the Execute button to apply and then execute this script. Upon each execution the circle alters its appearance. Turn on animation to execute periodically.
*/

/* Declaration blocks */

double cos(double a);
double sin(double a);

@@class() Circle:Object

@@method(public, class) (id)stored;
@@method(public, instance) (unsigned)animationCount;
@@method(public, instance) (void)sizeToCenteredWidth:(double)width height:(double)height;
@@method(public, instance) (void)moveCenterToXValue:(double)xValue yValue:(double)yValue;
@@method(public, instance) (void)setWedgeStartAngle:(double)startAngle endAngle:(double)endAngle;
@@method(public, instance) (void)setInteriorRed:(double)red green:(double)green blue:(double)blue alpha:(double)alpha;

@@end

/* Execution block */

{
id myCircle;
unsigned animationCount;
double radius, width, height;
double startAngle, endAngle;
double red, green, blue;
double pi;

myCircle = [Circle stored];

animationCount = [myCircle animationCount];

radius = 80.0 + 50.0 * cos(animationCount * 0.15 + 0.1);
width = 2.0 * radius;
height = 2.0 * radius;

/*
The angles are in units of radians
*/

pi = 3.1415926;

startAngle = pi * sin(animationCount * 0.1);
endAngle = 2.0 * pi;

red = 1.0;
green = 0.5;
blue = 0.5;

[myCircle sizeToCenteredWidth:width height:height];
[myCircle setWedgeStartAngle:startAngle endAngle:endAngle];
[myCircle setInteriorRed:red green:green blue:blue alpha:1.0];

}
